<?php
class CaptchaComponent extends Object {
	var $Controller = null;
	var $components = array('Session');
	function startup(&$controller){
		$this->Controller = $controller;
	}

	function render(){
		App::import('Vendor','kcaptcha/kcaptcha');
		$kcaptcha = new KCAPTCHA();
		$this->Controller->Session->write('captcha',$kcaptcha->getKeyString());
		exit();
	}

	function check($captcha){
		if($this->Session->check('captcha')){
			$s_captcha = $this->Session->read('captcha');
			if($captcha == $s_captcha){
				return true;
			}
		return false;
		}
	}
}
?>
